<?php

class admin_index extends MX_Controller {

	public function index(){
		$this->load->library('session');
		$setting =$this->load->Module('setting/admin');
		$this->template=$this->config->config['admin_template'];

		if($this->input->cookie('admin',TRUE))
			$this->session->set_userdata('admin', $this->input->cookie('admin',TRUE));
		
		if($this->session->userdata('admin')){
			$this->load->helper('url');
			global $CFG;
			if($url=$this->session->userdata('back_url')){
				$this->session->unset_userdata('back_url');
			}else $url=$CFG->config['base_url'].'product/admin';
			redirect($url);
		}
		
		$data=array(
				'update_footer'=>'merci de saissir votre mots de passe',
				'admin_title'=>'Page Admin',
		);
		$this->view(
				array('admin-login-header',
						'login',
						'admin-login-footer'),
			$data); // Display the page
    }
}